package com.bjfu.gmms.servlet.adminSecretaryServlet;

import com.bjfu.gmms.model.User;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/adminSecretaryDashboardServlet")
public class AdminSecretaryDashBoardServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取当前session中的用户信息
        HttpSession session = request.getSession();
        User user = (User) session.getAttribute("user");
        // 获取研究生管理秘书的学院ID
        int collegeId = user.getUser_id();
        System.out.println("欢迎" + collegeId + "号学院的研究生管理秘书进入系统");

        session.setAttribute("collegeId", collegeId);
        request.getRequestDispatcher("/adminSecretaryDashboard.jsp").forward(request, response);
    }
}
